/*
	Programação Concorrente
	Trabalho 1
	Turma A
	
	Adilson Rapozo
	Luiz Bertoni
	Rodrigo Costa

	This program counts how many digits are equal between files.
	stdin is compared to CORRECT_PI_FILE.
*/

#include <stdio.h>

#define CORRECT_PI_FILE "correctPi.txt"

int main ( void ) {

	int i = -2 ;
	char c;

	FILE * correctPiFile;

	correctPiFile = fopen ( CORRECT_PI_FILE , "r" ) ;

	while ( ( c = getchar ( ) ) == getc ( correctPiFile ) ) {

		if ( c == EOF ) {

			break ;
		}

		if ( c == 'e' ) {

			break ;
		}

		++ i ;
	}

	printf ( "%i correct digits.\n" , i ) ;

	fclose ( correctPiFile ) ;

	return 0 ;
}

